package com.zmn.plat.common.dictionary;

/**
 * 合同收付状态枚举
 *
 * @author linfeng
 * @since 2020/05/09 14:56:30
 */
public enum ContractPaymentStatusEnum {

    /**
     * values
     */
    ALLPAYMENT (1, "已收付"),
    NOTPAYMENT(2, "未收付"),
    PARTPAYMENT(3, "部分收付")
    ;

    private Integer code;
    private String name;

    ContractPaymentStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ContractPaymentStatusEnum of(Integer code) {
        if (code == null || code == 0) {
            return NOTPAYMENT;
        }
        switch (code) {
            case 1:
                return ALLPAYMENT;
            case 2:
                return NOTPAYMENT;
            case 3:
                return PARTPAYMENT;
            default:
                return NOTPAYMENT;
        }
    }
}
